var common = cc.Class({
    extends: cc.Component,

    properties: {
        tipsPrefab: cc.Prefab
    },

    statics: {
        init: null
    },

    // use this for initialization
    onLoad: function() {
        common.init = this; //这是节点自己component
        cc.game.addPersistRootNode(this.node);
    },
    
    toast: function(message, callback) {
        var node = cc.instantiate(this.tipsPrefab);
        node.parent = this.node;
        node.position = cc.p(0, 0);
        cc.log(node);
        node.getComponent('toast').show(message || "没有添加消息！", callback);
        // label.string = message || "没有添加消息！";
    },
    setMessage: function(message) {
        var node = cc.instantiate(this.tipsPrefab);
        node.parent = this.node;
        node.position = cc.p(0, 0);
        cc.log(node);
        node.getComponent('toast').setMessage(message);
        return node;
    },
    show: function(thistoast, message, callback) {
            thistoast.getComponent('toast').show(message || "没有添加消息！", callback);
        }
        // called every frame, uncomment this function to activate update callback
        // update: function (dt) {

    // },
});